package com.app.milkteaapp.utils;

import java.util.Random;

public class MyTools {
    public static final String URL = "http://192.168.0.102:8080";

    /**
     * 将性别转换为int
     * @param sex 性别
     * @return 转换完的int
     */
    public static int SexToint(String sex){
        int i = 0;
        if(sex.equals("男")){
            i=1;
        }else if(sex.equals("女")){
            i=2;
        } else if (sex.equals("未知")) {
            Random random = new Random();
            i = random.nextInt(9999+3);
        }
        return i;
    }

    /**
     * 将int转换为性别
     * @param i int
     * @return 性别
     */
    public static String intToSex(int i){
        if (i == 1) {
            return "男";
        } else if (i == 2) {
            return "女";
        } else {
            return "未知";
        }
    }
}
